<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:body>
        <h:form id="frmProfiles" >
            <p:commandButton value="Nuevo Perfil"
                             update=":frmNewProfile:dlgNewProfile"
                             oncomplete="dlgNewProfile.show();"
                             icon="ui-icon-plus" 
                             title="Nuevo Perfil"
                             actionListener="#{profileBean.prepareCreate()}"/>
            <br/>
            <br/>
            <p:dataTable id="dtProfiles" 
                         var="prof" value="#{profileBean.profiles}" 
                         emptyMessage="No se encontraron registros"
                         paginator="true" rows="10"  
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                         rowsPerPageTemplate="5,10,15">

                <p:column headerText ="Código"
                          filterBy="#{prof.prfCode}">
                    <h:outputText value="#{prof.prfCode}"/>

                </p:column>

                <p:column headerText="Nombre del Perfil" 
                          filterBy="#{prof.prfName}">
                    <h:outputText value="#{prof.prfName}" />  
                </p:column>

                <p:column style="width:4%">
                    <p:commandButton actionListener="#{profileBean.prepareUpdate(prof.prfCode)}"
                                     update=":frmEditProfile:dlgEditProfile"
                                     oncomplete="dlgEditProfile.show();"
                                     icon="ui-icon-arrowrefresh-1-n" 
                                     title="Editar"
                                     />  

                    <p:commandButton actionListener="#{profileBean.prepareUpdate(prof.prfCode)}"
                                     update=":frmDeleteProfile:dlgDeleteProfile"
                                     ajax="true"
                                     oncomplete="dlgDeleteProfile.show();"
                                     icon="ui-icon-circle-close" 
                                     title="Eliminar"/>  

                </p:column>

            </p:dataTable>  

        </h:form>

    </h:body>
</html>

